import request from '@/utils/request'
// ---------------- 登录相关--------------------
export function wxLogin(params) {
  return request({
    url: '/wechat/wx_login',
    method: 'post',
    params
  })
}

export function callBack(token) {
  return request({
    url: '/wechat/callBack',
    method: 'get',
    params: { token }
  })
}

export function getMenu(token) {
  return request({
    url: '/auth/menu',
    method: 'get',
    params: { token }
  })
}

export function logout() {
  return request({
    url: '/auth/logout',
    method: 'post'
  })
}
// ---------------- 用户管理相关 --------------------
export function page(data) {
  return request({
    url: '/user/page',
    method: 'get',
    params: data
  })
}

export function create(data) {
  return request({
    url: '/user',
    method: 'post',
    data
  })
}

export function edit(data) {
  return request({
    url: '/user',
    method: 'put',
    data
  })
}

export function deleteByIds(ids) {
  return request({
    url: '/user',
    method: 'delete',
    data: ids
  })
}
// Number userID ,List<Number> roleIds
export function assignRole(id, data) {
  return request({
    url: `/user/assignRole/${id}`,
    method: 'post',
    data
  })
}
